﻿/**
 * Created by rwecho001 on 14-8-26.
 */
PointSphere = function() {
    Sim.Object.call(this);
};

PointSphere.prototype = new Sim.Object();

PointSphere.prototype.init = function (point, spGeom, material) {
    var spMesh = new THREE.Mesh(spGeom, material);
    spMesh.position = point.Vector3;
    spMesh.pickUp = true; //是否可拾取。
    this.setObject3D(spMesh);
    this.spMesh = spMesh;
    this.point = point;
    this.Id = point.Id;
};


PointSphere.prototype.move = function(y, z) {
    this.point.Vector3.y += y;
    this.point.Vector3.z += z;
    this.spMesh.position = this.point.Vector3;
    return this.point.Vector3;
};

PointSphere.prototype.handleMouseMove = function (x, y) {
    var text = "序号: {0}<br />坐标：{1},{2},{3}<br />时间：{4}<br />孔深：{5}";
    var tips = text.format(this.point.Id, this.point.Vector3.x.toFixed(2), this.point.Vector3.y.toFixed(2), this.point.Vector3.z.toFixed(2), this.point.Date, this.point.Depth.toFixed(2));
    this.publish('mouseMove', x, y,tips);
};

PointSphere.prototype.handleMouseOut = function (x, y) {
    this.publish('mouseOut', x, y);
};

PointSphere.prototype.handleMouseDown = function (x, y) {
    this.publish('mouseDown', x, y, this.point.Id);
};
